package com.mate.cloud.auth.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;


/**
 * @description: java类作用描述
 * @author: MI
 * @email: 448341911@qq.com
 * @createTime: 2025/2/3 16:43
 * @updateUser: MI
 * @updateTime: 2025/2/3 16:43
 * @updateRemark: 修改内容
 * @version: v1.0
 */
public class MateUser implements UserDetails {


    private UmsUser umsUser;


    private List<GrantedAuthority> authorities;

    public MateUser(UmsUser umsUser, List<GrantedAuthority> authorities) {
        this.umsUser = umsUser;
        this.authorities = authorities;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.authorities;
    }

    @Override
    public String getPassword() {
        return umsUser.getPassWord();
    }

    @Override
    public String getUsername() {
        return umsUser.getUserName();
    }


    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }

    public UmsUser getUmsUser() {
        return umsUser;
    }
}
